<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>注册登录</title>
<link rel="stylesheet" type="text/css" href="Assets/css/reset.css"/>
<link rel="stylesheet" type="text/css" href="Assets/css/common.css"/>
<link rel="stylesheet" type="text/css" href="Assets/css/thems.css"/>
<style type="text/css">
	#nameexam,#firstexam,#secondexam{
		color:red;
	}
	#submitbutton{
		cursor:pointer;
	}
</style>
<script type="text/javascript" src="Assets/js/jquery-3.1.0.min.js" language="javascript"></script>
	<script type="text/javascript">
	var a=0;
	var b=0;
	var c=0;
	$(document).ready(function(){
		$("#username").blur(function(){
			var name=$("#username").val();
			var reg=/^[0-9a-zA-Z]{1,12}$/;
			if(!reg.test(name)){
				$("#nameexam").html("格式错误");
			}else{
				$.get(
					"CheckName",
					"name="+name,
					function(result){
						if (result=="true") 
						{
							$("#nameexam").html("已存在");
						} 
						else
						{
							$("#nameexam").html("");
							a=1;
						}
					}
				);
			}
		});
		$("#firstpassword").focus(function(){
			var name=$("#username").val();
			var reg=/^[0-9a-zA-Z]{1,12}$/;
			if(!reg.test(name)){
				$("#nameexam").html("格式错误");
			}else{
				$.get(
						"CheckName",
						"name="+name,
						function(result){
							if (result=="true") 
							{
								$("#nameexam").html("已存在");
							} 
							else
							{
								$("#nameexam").html("");
								a=1;
							}
						}
					);
			}
		});
		$("#secondpassword").focus(function(){
			var name=$("#username").val();
			var reg=/^[0-9a-zA-Z]{1,12}$/;
			if(!reg.test(name)){
				$("#nameexam").html("格式错误");
			}else{
				$.get(
						"CheckName",
						"name="+name,
						function(result){
							if (result=="true") 
							{
								$("#nameexam").html("已存在");
							}
							else
							{
								$("#nameexam").html("");
								a=1;
							}
						}
					);
			}
		});
		
		$("#firstpassword").blur(function(){
			var name=$("#firstpassword").val();
			var reg=/^[0-9a-zA-Z]{6,12}$/;
			if(!reg.test(name)){
				$("#firstexam").html("格式错误");
			}else{
				$("#firstexam").html("");
				b=1;
			}
		});
		$("#secondpassword").focus(function(){
			var name=$("#firstpassword").val();
			var reg=/^[0-9a-zA-Z]{6,12}$/;
			if(!reg.test(name)){
				$("#firstexam").html("格式错误");
			}else{
				$("#firstexam").html("");
				b=1;
			}
		});
		$("#secondpassword").blur(function(){
			var name=$("#firstpassword").val();
			var pad=$("#secondpassword").val();
			if(!(name==pad)){
				$("#secondexam").html("格式错误");
			}else{
				$("#secondexam").html("");
				c=1;
			}
		});
		$("#zhuce").submit(function(){
			if(a==0){
				alert("用户名错误");
				return false;
			}else{
				if(b==0){
					alert("密码错误");
					return false;
				}else{
					if(c==0){
						alert("两次密码不一致");
						return false;
					}else{
						return true;
					}
				}
			}
			
		});
		
	});
	</script>
</head>

<body>
<!--头部-->
<div class="head_bg">
	<div class="head clearfix">
    	<div class="logo"><a href="index.jsp"><img src="Assets/images/logo.png" alt=""/></a></div>
        <div class="menu">
        	
        	 <c:if test="${sessionScope.loginsuccess!=true}">
		        	<div class="head_top">
		            	<a href="login.jsp" class="submit">登录</a>
		                <a href="login.jsp" class="submit">注册</a>
		            </div>
		     </c:if>
		     <c:if test="${sessionScope.loginsuccess==true}">
		     		<div class="head_top">
		            	用户&nbsp;${sessionScope.username}&nbsp;已登录
		            	<a href="clearlogin" class="submit">退出</a>
		            </div>
		     </c:if>
            <ul class="clearfix">
            	<li class="now"><a href="index.jsp">首页</a></li>
                <li><a href="personal.jsp">我的资料</a></li>
				<li><a href="OrderQuery">我的物流</a></li>
				<li><a href="book.jsp">网上下单</a></li>
                <li><a href="news_d.jsp">帮助与支持</a></li>
                <li><a href="about.jsp">萤火物流</a></li>
            </ul>
        </div>
    </div>
</div>
<!--头部-->

<!--中间部分-->
<div class="main clearfix">
    <div class="login_reg clearfix">
    	<!--邮箱注册-->
        <div class="login_reg clearfix">
    	<!--邮箱注册-->
        <div class="reg">
        	<div class="lore_top">
            	<span>
                	<em>账号注册</em>
                </span>
            </div>
        	<form action="CheckReUser" id="zhuce" method="get">
        	<ul>
            	<li>
                	<span>用户名:</span>
                    <input name="username" id="username" type="text" placeholder="12位以内字母与数字组合"><span id="nameexam"> </span>
                </li>
                <li>
                	<span>密码:</span>
                    <input name="firstpassword" id="firstpassword" type="password" placeholder="6-16个字符"><span id="firstexam"> </span>
                </li>
                <li>
                	<span>确认密码:</span>
                    <input name="secondpassword" id="secondpassword" type="password" placeholder="和密码一致"><span id="secondexam"> </span>
                </li>
                <li class="tijiao">
                	<input type="submit" id="submitbutton" value="注册" class="submit">
                </li>
                
            </ul>
            </form>
        </div>
        <!--邮箱注册-->
    	<!--登录-->
        <div class="login">
        	<div class="lore_top">
            	<span>
                	<em>马上登录</em>
                </span>
            </div>
        	<form action="CheckReUserAndPassword" method="post">
        	<ul>
            	<li>
                	<span>用户名：</span>
                    <input name="username" id="username" type="text" placeholder="用户名/密码">
                </li>
                <li>
                	<span>密码：</span>
                    <input name="password" id="password" type="password" placeholder="6-16个字符">
                </li>
                <li class="tijiao">
                	<input type="submit" id="submitbutton" value="登录" class="submit">
                </li>
            </ul>
            </form>
        </div>
        <!--登录-->
    </div>
    <div class="space_hx">&nbsp;</div>
    
</div>
</div>
<!--中间部分-->
<div class="space_hx">&nbsp;</div>
<!--底部-->
<div class="foot_bg">
	<div class="foot">
    	<div class="foot_t">

        </div>
        <div class="copy">
        <a href="guanliyuan.jsp">管理员</a>
        	Copyright&copy;&nbsp;2012-2015&nbsp; 找物流有限责任公司.&nbsp;&nbsp;All&nbsp;&nbsp;rights&nbsp;&nbsp;reserved. &nbsp;&nbsp;粤ICP备10005645
        </div>
    </div>	
</div>
<!--底部-->
</body>
</html>
